export const modules = [
  {
    'moduleName': 'app1',
    'devPort': '8081',
  },
  {
    'moduleName': 'app2',
    'devPort': '8082',
  },
]
export const devHostname = location.hostname
const isDev = process.env.NODE_ENV === 'development'

export const formatQiankunApps = (modules, config = {}) => {
  const {
    container = '#appContainer',
    loader
  } = config

  return modules.map(item => {
    return {
      name: item.moduleName,
      entry: isDev ? `//${devHostname}:${item.devPort}` : `/${item.moduleName}`,
      container,
      loader,
      activeRule: `/${item.moduleName}`
    }
  })
}
